//
//  MineSettingVC.swift
//  DKE-Album
//
//  Created by 杨东宝 on 2020/5/30.
//  Copyright © 2020 杨东宝. All rights reserved.
//

import UIKit

class MineSettingVC: YDBBaseViewController {
    
    lazy var footerView: UIView = {
        let footer = UIView()
        footer.backgroundColor = UIColor.clear

        footer.frame = CGRect(x: 0, y: 0, width: kScreenWidth, height: DIMENSION_VALUE(60))
        
        let btn = UIButton.init(type: .custom)
        btn.backgroundColor
         =  hexColor(0xFAF8EF,0x2B2A3A)
        btn.setTitle("退出登录", for: .normal)
        btn.setTitleColor(HexRGB(0x8CC56C), for: .normal)//HexRGB(0x8CC56C)
        btn.titleLabel?.font = DIMENSION_FONT_OF_SIZE(16)
        btn.frame = CGRect(x: 0, y: DIMENSION_VALUE(10), width: kScreenWidth, height: DIMENSION_VALUE(50))
        btn.addTarget(self, action: #selector(btnClick(_ : )), for: .touchUpInside)
        footer.addSubview(btn)
        return footer
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.title = "系统设置"
        self.view.addSubview(tableView)
       tableView.myh_header?.isHidden = true
          tableView.myh_footer?.isHidden = true
    
        self.tableView.register(UITableViewCell.self, forCellReuseIdentifier: "MineSystemBaseCell")
        tableView.snp.makeConstraints { (make) in
            make.left.right.equalToSuperview()
            make.bottom.equalToSuperview()
            make.top.equalToSuperview().offset(10)
        }
        
        settingFooterView()
    }
    
    //设置header
    func settingFooterView() {
        
        tableView.tableFooterView = footerView
        
    }
    //退出登录点击方法
    @objc func btnClick(_ : UIButton ) {
        userManger.loginOut { (suc, str) in
          
        }
    }
}
// MARK:-TableView代理
extension MineSettingVC{
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 4
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell :  UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell") as! UITableViewCell
        cell.selectionStyle = .none
        return cell
   
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if indexPath.row == 3 {
            
        }
    }

}
